from django.db import models

from sportsground.utils.baseModels import BaseModels


class GoodsType(BaseModels):
    class Meta():
        db_table = 'venue_goodsType'
        verbose_name = '馆场商品类型'
        verbose_name_plural = verbose_name

    venue = models.ForeignKey(to="Venue.Venue", on_delete=models.CASCADE, verbose_name="对应场馆")
    desc = models.CharField(max_length=200, verbose_name="描述")

    @classmethod
    def create(cls, venue=venue, desc=''):
        """ 创建 """
        goodType = cls(venue=venue, desc=desc)
        goodType.save()
        return goodType

    def Info(self):
        return {
            "id": self.id,
            "desc": self.desc,
        }
